package com.sinopec.uhf.initrc

import com.payne.reader.bean.config.MemBank
import com.payne.reader.bean.send.ReadConfig


//读写器配置类
data class Config(

    //读的配置
    val readConfig: ReadConfig,
    //更换天线的配置延迟
    val changeWorkAntennaTime: Long = 100,

    //每次读取标签的间隔
    val readTagOneTime: Long = 110,

    ) {

    companion object {

        //如果没有值 则会使用默认的来创建一个
        var defaultConfig: Config = Config(
            readConfig = createDefault()
        )

        fun createDefault(): ReadConfig {
            //读标签
            val memBank = MemBank.valueOf(3.toByte())
            val startAddress = 0.toByte()
            val readLen = 6

            val config = ReadConfig.Builder()
                .setPasswords("00000000")
                .setMemBank(memBank)
                .setWordStartAddress(startAddress)
                .setWordLength(readLen.toByte())
                .build()
            return config
        }

    }

}